With development of a mobile communications technology and a near field communication (English: Near Field Communication, NFC for short) technology, more mobile terminals support a payment service that has a relatively high requirement on a security level. This mobile terminal is referred to as an NFC terminal. Generally, the NFC terminal includes a near field communication controller (English: Near Field Communication Controller, NFCC for short), an NFC antenna, and at least one secure element (English: Secure Element, SE for short).
With development of the mobile payment industry, one NFC terminal can include multiple SEs, and multiple contactless applications can be installed in each SE. For convenience of distinguishing multiple contactless applications, generally each contactless application has one application identifier (English: Application Identification, AID for short). When the NFC terminal enters a radio frequency field of an NFC card reader, an NFC antenna generates an induced current, and an NFCC connected to the NFC antenna receives a contactless application selection command sent by the NFC card reader. To forward the command to a correct SE, a device host (English: Device Host, DH for short) of the NFC terminal needs to configure routing information for the NFCC, that is, configure a correspondence between the AID and the SE, and other routing information into the NFCC. In this way, the NFCC can forward the command to the correct SE, and then select a correct contactless application.
In the prior art, a method for the DH to configure the routing information into the NFCC is: A method of statically reporting an AID of a contactless application is provided by using a companion application of the contactless application and a configuration file that is written into the NFC terminal. Specifically, the contactless application is installed into the SE, and the companion application of the contactless application is also installed into the NFC terminal, where the companion application includes a configuration file, and the configuration file identifies the AID of the contactless application. When an application manager is refreshed, the companion application is discovered, and the AID in the configuration file in the companion application is obtained, and is configured into the NFCC. However, this method is not flexible enough. For a contactless application that does not have a companion application, even if the contactless application is installed into the SE, the terminal cannot obtain an AID.
Therefore, a disadvantage of the prior art is: An NFC terminal cannot obtain an AID of a contactless application in an SE in real time.